import reader
import cv2
import numpy as np
import glob

'''
rs_channels = reader.read_rs('./data/rs_08/NC_H08_20200801_0020_R21_FLDK.06001_06001.nc')
cld = reader.read_cld('./data/cld_08/NC_H08_20200801_0020_L2CLP010_FLDK.02401_02401.nc')
cld_r = cv2.resize(cld,(rs_channels['albedo_01'].shape[0],rs_channels['albedo_01'].shape[1]),interpolation=cv2.INTER_NEAREST)


rs_img = cv2.merge((rs_channels['albedo_03'],rs_channels['albedo_04'],rs_channels['albedo_05']))
cld_d = reader.cld_dye(cld)
mask = cv2.resize(cld_d,(6001,6001),interpolation=cv2.INTER_NEAREST)

reader.crop_img(mask, out_dir='./mask_out', cld=cld_r, name='mask')
'''

'''
cld = reader.read_cld('./data/cld_12/NC_H08_20201201_0000_L2CLP010_FLDK.02401_02401.nc')
mask = reader.cld_dye(cld)
reader.save_img(mask,'./mask_12',"mask_12")
'''

'''
file_names = glob.glob('./data/6001/*.*')

for file_name in file_names:
    rs_channels = reader.read_rs(file_name)
    start = file_name.find('H08')
    end = file_name.find('R21')
    name = file_name[start:end]
    rgb_name = name+'rgb.png'
    inf_name = name+'inf.png'

    reader.ndarrdy_to_img([rs_channels['albedo_01'],rs_channels['albedo_02'],rs_channels['albedo_03']],
                          './data',
                          rgb_name)
    reader.ndarrdy_to_img([rs_channels['albedo_03'], rs_channels['albedo_04'], rs_channels['albedo_05']],
                          './data',
                          inf_name)
    print(file_name)




'''

print('123')
